/***************************************************************************
 *                                                                         *
 *   This file is part of the CrystalMem project,                          *
 *       http://code.google.com/p/crystalmem                               *
 *                                                                         *
 *   Copyright (C) 2008 by Alberto Scarpa <scarpa.alberto@gmail.com>       *
 *   Copyright (C) 2008 by Enrico Ros <enrico.ros@gmail.com>               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef __WidgetItem_h__
#define __WidgetItem_h__

#include <QGraphicsItem>
#include <QSizeF>

class WidgetItem : public QGraphicsItem {
    public:
        WidgetItem( QGraphicsItem * parent = 0 );

        // additions to a standard QGraphicsItem (that already has x(), y(), paint(..), etc..)
        void move( qreal x, qreal y );
        void move( const QPointF & point );
        void resize( qreal width, qreal height );
        void resize( const QSizeF & size );
        float width() const;
        float height() const;
        QSizeF size() const;
        virtual QSizeF minimumSizeHint() const;

        // ::QGraphicsItem
        QRectF boundingRect() const;
        virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );

    protected:
        virtual void resizeEvent( const QSizeF & size );

    private:
        QSizeF  m_size;
};

#endif
